home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15925 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: opengovt.open.org!john
  2. From: THayworth@open.org (Tina Hayworth)
  3. Newsgroups: comp.lang.c++
  4. Subject: HELP - Passing strings to a DLL
  5. Date: 8 Apr 1996 15:31:46 GMT
  6. Organization: OPEN.ORG
  7. Message-ID: <4kbbh2$r3c@hp_open.open.org>
  8. NNTP-Posting-Host: 199.2.103.4
  9. Mime-Version: 1.0
  10. Content-Type: Text/Plain; charset=US-ASCII
  11. X-Newsreader: WinVN 0.99.7
  12.  
  13.  
  14. I am not an experienced C++ programmer, but I have taken a couple C 
  15. classes a few years ago.  I need to write a simple DLL that will be called by 
  16. VB.
  17.  
  18. I found some sample code, wrote the program, and it worked - I thought I had 
  19. it all figured out. But if I try passing a pointer to a large string to a 
  20. function in the DLL, I get a GPF.
  21.  
  22. In the code below, if commarea is 40 bytes or less it works.  If it is larger 
  23. I get a GPF.  The actual string I need to pass is 11,452 bytes.
  24.  
  25. Can anyone tell me what I am doing wrong?
  26.  
  27. Here is the function I am calling:
  28.  
  29. int FAR PASCAL EciSync (char server[], char userid[], char passwd[],
  30.                         char program[], char transid[], char *commarea, int 
  31. comsize)
  32. ---------------------------------------------------------------------------
  33. Here is my DEF file:
  34.  
  35. LIBRARY  ECIDLLL
  36.  
  37. EXETYPE WINDOWS 
  38.  
  39. SEGMENTS
  40.         WEPSEG      PRELOAD FIXED
  41.  
  42. CODE    PRELOAD MOVEABLE DISCARDABLE
  43. DATA    PRELOAD MOVEABLE SINGLE
  44.  
  45. HEAPSIZE 5120
  46.  
  47. EXPORTS
  48.         WEP             @1     RESIDENTNAME
  49.         EciSync         @2
  50. ------------------------------------------------------------------------
  51. Here is the Declaration in VB:
  52.  
  53. Declare Sub EciSync Lib "ecidll.dll" (ByVal S As String, ByVal U As String, 
  54. ByVal P As String, ByVal Pg As String, ByVal T As String, ByVal c As String, 
  55. ByVal S As Integer)                                                      
  56.  
  57.  
  58.